{% extends 'admin/common/base.html'%}

{% block body %}
<!-- 头部 -->
{% include 'admin/common/top.html' %}
<!-- /头部 -->

<div class="main-container container-fluid">
    <div class="page-container">
        <!-- Page Sidebar -->
        {% include 'admin/common/left.html' %}
        <!-- /Page Sidebar -->
        <!-- Page Content -->
        <div class="page-content">
            <!-- Page Breadcrumb -->
            <div class="page-breadcrumbs">
                <ul class="breadcrumb">
                    <li>
                        <a href="{{url_for('link.link')}}">链接管理</a>
                    </li>
                    <li class="active">添加链接</li>
                </ul>
            </div>
            <!-- /Page Breadcrumb -->

            <!-- Page Body -->
            <div class="page-body">
                <div class="row">
                    <div class="col-lg-12 col-sm-12 col-xs-12">
                        <div class="widget">
                            <div class="widget-header bordered-bottom bordered-blue">
                                <span class="widget-caption">新增链接</span>
                            </div>
                            <div class="widget-body">
                                <div id="horizontal-form">
                                    <form class="form-horizontal" role="form" action="{{url_for('link.add_link')}}"
                                        method="post" novalidate="true">
                                        {{form.csrf_token}}

                                        <div class="form-group">
                                            <label for="username"
                                                class="col-sm-2 control-label no-padding-right">{{form.linkname.label}}</label>
                                            <div class="col-sm-6">
                                                {{form.linkname(class='form-control', placeholder='请输入名称')}}
                                            </div>
                                            <p class="help-block col-sm-4 red">* 必填</p>
                                        </div>
                                        {% if form.linkname.errors %}
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label no-padding-right"></label>
                                            <div class="col-sm-6 red">
                                                {% for msg in form.linkname.errors%}
                                                {{msg}}
                                                {% endfor %}
                                            </div>
                                        </div>
                                        {% endif %}

                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right">{{form.url.label}}</label>
                                            <div class="col-sm-6">
                                                {{form.url(class='form-control', placeholder='请输入地址')}}
                                            </div>
                                            <p class="help-block col-sm-4 red">* 必填</p>
                                        </div>
                                        {% if form.url.errors %}
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label no-padding-right"></label>
                                            <div class="col-sm-6 red">
                                                {% for msg in form.url.errors%}
                                                {{msg}}
                                                {% endfor %}
                                            </div>
                                        </div>
                                        {% endif %}

                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right">{{form.description.label}}</label>
                                            <div class="col-sm-6">
                                                {{form.description(class='form-control')}}
                                            </div>
                                            <p class="help-block col-sm-4 red"></p>
                                        </div>
                                        {% if form.description.errors %}
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label no-padding-right"></label>
                                            <div class="col-sm-6 red">
                                                {% for msg in form.description.errors%}
                                                {{msg}}
                                                {% endfor %}
                                            </div>
                                        </div>
                                        {% endif %}

                                        <div class="form-group">
                                            <label for="username" class="col-sm-2 control-label no-padding-right">{{form.sort.label}}</label>
                                            <div class="col-sm-6">
                                                {{form.sort(class='form-control', placeholder='请输入排序', value=0, type="number")}}
                                            </div>
                                            <p class="help-block col-sm-4 red">* 必填</p>
                                        </div>

                                        <div class="form-group">
                                            <div class="col-sm-offset-2 col-sm-10">
                                                {{form.submit(class='btn btn-default')}}
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}